<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ModifyProduct extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasColumn('product', 'date_buy')) {
            Schema::table('product', function (Blueprint $table) {
                $table->string('date_buy', 64)->after('address')->default('')->comment('购买日期');
            });
        }
        if (!Schema::hasColumn('product', 'date_check')) {
            Schema::table('product', function (Blueprint $table) {
                $table->string('date_check', 64)->after('date_buy')->default('')->comment('验收日期');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
